package com.xltq.dao.impl;

import com.xltq.dao.ITypeDao;
import com.xltq.entity.Type;
import com.xltq.utils.C3P0Utils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;


import java.util.List;

public class ITypeDaoImpl implements ITypeDao {
    @Override
    public List<Type> selectAll() throws Exception {
        QueryRunner queryRunner = new QueryRunner(C3P0Utils.getDataSource());
        String sql = "select t_id as tid,t_name as tname,t_info as tinfo from type";
        List<Type> query = queryRunner.query(sql, new BeanListHandler<Type>(Type.class));
        return query;


    }
}
